#include "connection.h"
#include "loger.h"
Connection::Connection(qintptr handle, QObject * parent):QTcpSocket (parent)
{
    this->setSocketDescriptor(handle);
    //事件绑定
    connect(this, SIGNAL(readyRead()), this, SLOT(slotReadClientData()));
    connect(this, SIGNAL(disconnected()), this, SLOT(slotClientDisconnected()));
}
Connection::~Connection(){
    QString s("连接connection已析构");
    Loger::info(s);
}

/**
 * 有数据可读
 * @brief slotReadClientData
 */
void Connection::slotReadClientData(){
    emit recvdData(this);
}
/**
 * 连接断开
 * @brief slotClientDisconnected
 */
void Connection::slotClientDisconnected(){
    emit disconnected(this);
}
